jQuery(document).ready( function() {	
	jQuery('.profiEditButton').on('click', function() {
 	    jQuery('.message').hide();
 	    jQuery('.changePasswordForm').show();
 	    jQuery(this).hide();
	});
	
	jQuery('.profiEdit .updatePasswordButton').on('click', function() {
 	    jQuery('.message').hide();
 	    var userEmail = jQuery('.userEmail').text();
		var oldPassword = jQuery('.oldPassword').val();
		var newPassword = jQuery('.newPassword').val();
		jQuery.ajax({
	            url : "updatePassword",
	            type: "POST",
	            dataType: 'text',
	            data:  { userEmail: userEmail, oldPassword: oldPassword, newPassword: newPassword },
	            success : function(msg) {
	         	    jQuery('.changePasswordForm').hide();
	 	    	    jQuery('.message').html(msg);
	 	    	    jQuery('.message').show();
	 	    	}
	    });
	});
});